<template>
  <el-form :model="fromObj" size="samll" label-width="100px">
    <el-form-item label="订单号">
      <el-input v-model="fromObj.orderNo"></el-input>
    </el-form-item>

    <el-form-item label="下单时间">
      <el-input v-model="fromObj.orderTime"></el-input>
    </el-form-item>
    <el-form-item label="手机号">
      <el-input v-model="fromObj.phone"></el-input>
    </el-form-item>
    <el-form-item label="收货人">
      <el-input v-model="fromObj.consignee"></el-input>
    </el-form-item>

    <el-form-item label="收货地址">
      <el-input v-model="fromObj.deliverAddress"></el-input>
    </el-form-item>
    <el-form-item label="送达时间">
      <el-input v-model="fromObj.deliveryTime"></el-input>
    </el-form-item>
    <el-form-item label="备注">
      <el-input v-model="fromObj.remarks"></el-input>
    </el-form-item>
    <el-form-item label="订单金额">
      <el-input v-model="fromObj.orderAmount"></el-input>
    </el-form-item>
    <el-form-item label="订单状态">
      <el-input v-model="fromObj.orderState"></el-input>
    </el-form-item>

    <el-form-item>
      <el-button type="primary" @click="gofn">修改</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
import {api_detail,api_edit } from "../../api/order";
export default {
  data() {
    return {
      id: this.$route.query.id,
      fromObj: {
        orderNo: "",
        orderTime: "",
        phone: "",
        consignee: "",
        deliverAddress: "",
        deliveryTime: "",
        remarks: "",
        orderAmount: "",
        orderState: "",
      },
    };
  },
  mounted() {
    this.queryone();
  },
  methods: {
    async queryone() {
      let rst = await api_detail({ id: this.$route.query.id });
      this.fromObj = rst.data;
      console.log(rst);
    },

  async  gofn(){
      let rst=await  api_edit( this.fromObj)
      console.log(rst)
      let{code,msg}=rst
      if(code==0){
        this.$message.success(msg)
      }else{
        this.$message.error(msg)
      }
    }
  },

};
</script>

<style lang="less" scoped>
</style>